IMotion.SetAxisGearInPos method
Commands a gear ratio between the position of the slave and master axes from the synchronization point onwards.
NOTE: To use SetGearInPos(), the master axis must already be moving and with constant velocity.
How it works:
First, the slave axis does a IMotion.MoveAxisContinuousAbsolute method move to reach the SlaveSyncPosition at the right time with the right velocity. The Velocity, Acceleration, and Deceleration inputs are for this IMotion.MoveAxisContinuousAbsolute method move. While this move is running, the StartSync output is TRUE. Once this motion is done, the InSync output is TRUE.
GearInPos profiles:
- If MasterStartDistance is non-zero, the slave axis will start moving once the master position reaches MasterSyncPosition +- MasterStartDistance. Velocity is treated as max velocity that may not be reached, so basically it is omitted unless it is too low and then an error will be triggered as no compatible profile can be generated.
- If MasterStartDistance is zero and Velocity is non-zero, the shortest possible profile will be calculated based on the maximum velocity provided.
- If both MasterStartDistance and Velocity are zero, KINGSTAR will generate the smoothest profile as possible.
Assembly: IntervalZero.KINGSTAR.Base.Api (in IntervalZero.KINGSTAR.Base.dll) Version: 4.4.0.0
Syntax
KsCommandStatus SetAxisGearInPos(
int Master,
int Slave,
bool Permanent,
double Ratio,
McSource MasterValueSource,
double MasterSyncPosition,
double SlaveSyncPosition,
McSyncMode SyncMode,
double MasterStartDistance,
double Velocity,
double Acceleration,
double Deceleration,
double Jerk,
McBufferMode BufferMode
)
Function SetAxisGearInPos(
Master As Integer,
Slave As Integer,
Permanent As Boolean,
Ratio As Double,
MasterValueSource As McSource,
MasterSyncPosition As Double,
SlaveSyncPosition As Double,
SyncMode As McSyncMode,
MasterStartDistance As Double,
Velocity As Double,
Acceleration As Double,
Deceleration As Double,
Jerk As Double,
BufferMode As McBufferMode
) As KsCommandStatus
Parameters
Master [in]
Type: int
The index of the master axis. Indexes are zero based. Aliases affect this parameter.
Slave [in]
Type: int
The index of the slave axis. Indexes are zero based. Aliases affect this parameter. The number of slaves is up to 32.
Permanent [in]
Type: bool
Determines whether the gear state is preserved after the motor is disabled.
true: the gear state is preserved even if the motor is disabled. For example, if the master axis is enabled, the slave axis will be enabled. If an error has occurred on the master, it occurred on the slave too.
false: the gear state won't be preserved after the motor is disabled.
Ratio [in]
Type: double
The gear ratio.
MasterValueSource [in]
Type: McSource
Defines the source for synchronization.
- mcSetValue – synchronization on master set value. We suggest you use these settings.
- mcActualValue – synchronization on master actual value. This setting may not be stable.
- mcSecondEncoderValue – actual value of the secondary encoder of the axis.
NOTE: mcSecondEncoderValue is not supported yet.
MasterSyncPosition [in]
Type: double
The master's position where the slave is in sync with the master.
SlaveSyncPosition [in]
Type: double
The slave's position where the slave is in sync with the master.
SyncMode [in]
Type: McSyncMode
Defines the way to synchronize.
MasterStartDistance [in]
Type: double
The distance for the master to travel to synchronize with the slave (when the slave axis is started to get into synchronization).
Velocity [in]
Type: double
The maximum velocity during the synchronization phase.
Acceleration [in]
Type: double
The maximum acceleration during the synchronization phase.
Deceleration [in]
Type: double
The maximum deceleration during the synchronization phase.
Jerk [in]
Type: double
The maximum jerk during the synchronization phase.
BufferMode [in]
Type: McBufferMode
Defines how to blend the velocity of two methods.
Return value
Type: KsCommandStatus
Returns the KsCommandStatus class.
Remarks
- If MasterStartDistance is implemented, any previous motion is continued until the master crosses either MasterSyncPosition or MasterStartDistance in the correct direction (according to the sign of MasterStartDistance). When a stop command is run on the slave axis before the synchronization has happened, it cancels the synchronization and the method sends CommandAborted.
- If the MasterStartDistance is not specified, the system itself can calculate the set point for synchronization based on the other relevant inputs.
- In SyncMode, the difference between
mcCatchUp
andmcSlowDown
is the energy needed to synchronize. Compared tomcCatchUp
,mcSlowDown
needs lower energy. - To detach the slave axis, use ReleaseAxis.
- When modulo axis is enabled, only the master axis can be configured as a modulo axis, and MasterSyncPosition will be converted to a modulo value. However, MasterStartDistance will not be converted. For example, with a modulo value of 360, if the current position of the master axis is 0, the velocity is set to 180/s, and MasterSyncPosition is set to -20, the master axis will use 340 as the sync position.
Examples
N/A
See also